#include "mainwindow.h"
#include "ui_mainwindow.h"

#include "combo_pages_helper.h"  // 填下拉框
#include "page_helper.h"         // 切页面

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // combo init
    init_pages_combo(ui->combo_pages);

    //
    ui->combo_pages->setCurrentIndex(PAGE_PREVIEW);
    apply_page(ui, PAGE_PREVIEW);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_combo_pages_currentIndexChanged(int index)
{
    //
    int pageId = ui->combo_pages->itemData(index).toInt();
    apply_page(ui, pageId);
}
